package demo3;

public class Test {
    public static void func(Animal animal) {
        animal.eat();
    }
    public static void testFly(IFly iFly) {
        iFly.iFly();
    }
    public static void testRun(IRun iRun) {
        iRun.iRun();
    }
    public static void testSwim(ISwim iSwim) {
        iSwim.iSwim();
    }
    public static void  testAmphibious(IAmphibious iAmphibious) {
        iAmphibious.iSwim();
        iAmphibious.iRun();
    }
    public static void main(String[] args) {
        //接口间的继承
        //：用接口可以达到多继承的目的。接口可以继承一个接口, 达到复用的效果. 使用 extends 关键字
        testAmphibious(new Crocodile("鳄鳄"));
    }
    public static void main5(String[] args) {
        func(new Bird("布谷"));
        testSwim(new Dog("小黑"));
        testRun(new Robot());
        testFly(new Duck("啤酒鸭"));
    }
    public static void main4(String[] args) {
        testSwim(new Dog("小黑"));
        testSwim(new Duck("可达鸭"));
    }
    public static void main3(String[] args) {
        testRun(new Bird("布谷"));
        testRun(new Dog("小黑"));
        testRun(new Robot());
        testRun(new Duck("可达鸭"));
    }
    public static void main2(String[] args) {
        testFly(new Bird("布谷"));
        testFly(new Duck("可达鸭"));
    }
    public static void main1(String[] args) {//测试吃
        //Bird bird = new Bird("布谷");
        func(new Bird("布谷"));
        func(new Dog("小黑"));
        func(new Duck("可达鸭"));
    }
}
